<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>编辑栏目 - Powered By Betou</title>
<meta name="author" content="Betou Team" />
<meta name="copyright" content="Betou" />
<#include "../head.html"/>
<script type="text/javascript">
var groups = '${channel.orientedGroup!}';
var smsGroups = '${channel.smsGroup!}';
$().ready(function() {
	
	$("#inputForm input[name*=userGroup]").each(function() {
		var role = $(this).val();
		for(var i=0,len=groups.length;i<len;i++) {
			if(groups[i]==role) {
				$(this).attr("checked",true);
				break;
			}
		}
	});

	$("#inputForm input[name*=smsGroups]").each(function() {
		var role = $(this).val();
		var smsGroupArr = smsGroups.split(',');
		for(var i=0,len=smsGroupArr.length;i<len;i++) {
			if(smsGroupArr[i]==role) {
				$(this).attr("checked",true);
				break;
			}
		}
	});
	
	var $inputForm = $("#inputForm");
	
	// 表单验证
	$inputForm.validate({
		rules: {
			name:"required",
			path:"required",
			priority:{
				required: true,
				digits: true,
				min:0
			},
			txt:{
				maxlength:100
			}
		},
	});


	
	
});
</script>
</head>
<body class="content">
	<div class="path">
		<a href="../index.jspx">首页</a> &raquo; 编辑栏目
	</div>
	<form id="inputForm" action="o_update.jspx" method="post"  >
		<input type="hidden" name="id" value="${channel.id}"/>
		<table class="input tabContent">
			<tr>
				<th>上级栏目</th>
				<td>
					<select name="parentId">
						<option value="" <#if !channel.parent??>selected</#if>>顶级栏目</option>
						<#if channelList?size gt 0><#assign origDeep=channelList[0]["deep"]+1/></#if>
						<#list channelList as item>
							<option value="${item.id}" <#if channel.parent??><#if item["id"]?string==channel.parent.id?string> selected="selected"</#if></#if>>
							<#if item["deep"] gte origDeep><#list origDeep..item["deep"] as i>&nbsp;&nbsp;</#list>></#if>
							${item.name}
							</option>
						</#list>
					</select>
				</td>
			</tr>
			<tr>
				<th><span class="requiredField">*</span>栏目名称:</th>
				<td>
					<input type="text" name="name" class="text" maxlength="100"  value="${channel.name!}"/>
				</td>
			</tr>
			<tr>
				<th><span class="requiredField">*</span>面向用户:</th>
				<td>
					<#list groupList as g>
						<input type="checkbox" name="userGroup" value="${g.id!}"/>${g.name!}
					</#list>
				</td>
			</tr>
			<tr>
				<th>短信发送:</th>
				<td>
					<#if group??>
						<input type="checkbox" name="smsGroups" value="${group.id}"/><span class="red">${group.name!}</span>
					</#if>
					<#list groupList as g>
						<input type="checkbox" name="smsGroups" value="${g.id}"/>${g.name!}
					</#list>
				</td>
			</tr>
			<tr>
				<th><span class="requiredField">*</span>排列顺序:</th>
				<td>
					<input type="text" name="priority" class="text" maxlength="9"  value="${channel.priority!}"/>
				</td>
			</tr>
		</table>
		
		<table class="input">
			<tr>
				<th>
					&nbsp;
				</th>
				<td>
					<input type="submit" class="button" value="确&nbsp;&nbsp;定" />
					<input type="button" class="button" value="返&nbsp;&nbsp;回" onclick="location.href='v_list.jspx'" />
				</td>
			</tr>
		</table>
	</form>
</body>
</html>
